package tw.cuttle.entry;

import java.io.IOException;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

import tw.cuttle.CuttleContext;
import tw.cuttle.bean.Actions;

/**
 * Servlet implementation class RequestServlet
 */
public class RequestServlet extends HttpServlet {
    
	private static final long serialVersionUID = 1L;
	private EntryHelper entryHelper=new EntryHelper();
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public RequestServlet() {
        super();
        // TODO Auto-generated constructor stub
    }
	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		execute(request, response);
	}
    /**
     * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
     */
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    	execute(request, response);
    }
    protected void execute(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
    	entryHelper.execute(request, response);
    }
    protected void execute(String providedActionId, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
    	entryHelper.execute(providedActionId, request, response);
    }
    /**
	 * @return the entryHelper
	 */
	public EntryHelper getEntryHelper() {
	    return entryHelper;
	}

	public void init(ServletConfig config) throws ServletException{
	    entryHelper.init(config.getServletContext());
	    
	}

	/**
	 * @param entryHelper the entryHelper to set
	 */
	public void setEntryHelper(EntryHelper entryHelper) {
	    this.entryHelper = entryHelper;
	}

}
